package top.zhimingw.draw;

import javax.swing.*;
import java.awt.*;

/**
 * @Author:zhimingw
 * @Version 1.0
 */
public class DrawCircle extends JFrame{
    private MyPanel mp = null;
    public static void main(String[] args) {
        new DrawCircle();
    }

    public DrawCircle(){
        //初始化面板
        mp = new MyPanel();
        //框架中嵌入画板
        this.add(mp);
        //设置窗口大小
        this.setSize(400,300);
        //当点击窗口的x,陈旭退出
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true); //可以显示

    }


}

class MyPanel extends JPanel{
    //Graphics g 画笔
    @Override
    public void paint(Graphics g) {
        super.paint(g);//初始化画板
        System.out.println("调用paint");
        g.drawOval(10,10,100,100);
    }
}
